package com.fastloan.jn.mgt.customermanager.level.service.impl;

import com.fastloan.jn.common.BasicServiceImpl;
import com.fastloan.jn.utils.other.ObjUtil;
import com.kawins.base.BaseService;
import com.fastloan.jn.mgt.customermanager.level.service.JnManagerMonthAssessService;
import com.fastloan.jn.mgt.customermanager.level.model.JnManagerMonthAssess;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author gelon
 *         createTime 2017/10/31
 */
@org.springframework.stereotype.Service
public class JnManagerMonthAssessServiceImpl extends BasicServiceImpl<JnManagerMonthAssess> implements JnManagerMonthAssessService {
    @org.springframework.beans.factory.annotation.Autowired
    private com.fastloan.jn.mgt.customermanager.level.dao.JnManagerMonthAssessMapper JnManagerMonthAssessMapper;

    @Override
    @Transactional
    public void saveUpdate(List<JnManagerMonthAssess> managerMonthAssesses) {
        managerMonthAssesses.forEach(this::saveUpdate);
    }

    private void saveUpdate(JnManagerMonthAssess jnManagerMonthAssess) {
        if(ObjUtil.isEmpty(jnManagerMonthAssess.getId())){
            insertSelective(jnManagerMonthAssess);
        }else{
            updateByPrimaryKey(jnManagerMonthAssess);
        }
    }
}
